package chapter05;

public class Test01_String {
    public static void main(String[] args) {
        //定义字符串
        String a = "abc";
        //构造函数定义字符串
        String b = new String();//空字符串 ""
        String c = new String("abc");
        //使用字符数组定义
        char[] value = {'a','b','c'};
        String d = new String(value);
        System.out.println(d);
        //使用byte类型数组定义
        byte[] bs = {97,98,99};//根据ASCII进行字符转换的
        String e = new String(bs);
        System.out.println(e);
        //字符串的比较 == equals
        //== 比较栈空间的值
        String f = a;
        System.out.println(f==a);//true
        String h = new String(a);
        System.out.println(h==f);//false
        System.out.println(h);
        //equals比较本身的值
        System.out.println(h.equals(f));//true
    }
}
